<template>
  <el-form-item
    label="规格名称"
    prop="name"
    :rules="rules"
    class="common-form-width"
  >
    <el-input
      v-model.trim="modelValue"
      placeholder="请输入规格名称"
      maxlength="100"
      show-word-limit
    ></el-input>
  </el-form-item>
</template>

<script lang="ts" setup>
const props = withDefaults(
  defineProps<{
    modelValue: string;
  }>(),
  {
    modelValue: "",
  }
);

const emits = defineEmits(["update:model-value"]);
const modelValue = computed({
  set(newValue) {
    emits("update:model-value", newValue);
  },
  get() {
    return props.modelValue;
  },
});

const rules = [
  {
    required: true,
    message: "请输入规格名称",
    trigger: "blur",
  },
];
</script>

<style scoped lang="scss">
@use "@/components/goodsCenter/styles/common.scss";
</style>
